package com.qys.livesMall.app.user.model.enums;

import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * Created by IntelliJ IDEA.
 * User: dp
 * Date: 2023/04/24
 * Time: 15:26
 * DESCRIPTION: 用户余额变动类型
 */
@Getter
@AllArgsConstructor
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum UserBalanceLogTypeEnum implements IEnum<Integer> {

    STORE_ORDER(0, "商城订单"),
    STORE_ORDER_RETURN(1, "商城订单退款"),
    RECHARGE(2, "充值"),
    SYSTEM_CHANGE(3, "后台修改"),
    WITHDRAWALS(4, "提现"),
    INVITE(5, "邀请奖励"),
    FINANCIAL_OFFLINE(6, "线下理财"),
    FINANCIAL_OFFLINE_CHILD_REWARD(7, "线下理财分佣"),
    EXCHANGE_GOLD(8, "兑换金币"),
    ONLINE_OFFLINE(9, "线上理财"),
    ONLINE_OFFLINE_FINANCIAL(10, "线上理财本金"),
    ONLINE_OFFLINE_EARNINGS(11, "线上理财收益"),
    ONLINE_OFFLINE_EARNINGS_DIVIDED(12, "线上理财收益分成"),

    SUBORDINATE_COMMISSION(13, "下级分佣"),

    DIVIDED_COMMISSION_WITH_GOODS(14,"带货分佣")

    ;


    private final int code;
    private final String name;

    public static UserBalanceLogTypeEnum getEnum(Integer code) {
        for (UserBalanceLogTypeEnum balanceLogTypeEnum : UserBalanceLogTypeEnum.values()) {
            if (balanceLogTypeEnum.getCode() == code) {
                return balanceLogTypeEnum;
            }
        }
        return null;
    }

    @Override
    public Integer getValue() {
        return this.code;
    }
}
